using UnityEngine;
using UnityEngine.UIElements;

namespace MLTimeline.Editor
{
    public class TrackView : VisualElement
    {
        public TrackView()
        {
            CreateGUI();
        }

        private void CreateGUI()
        {
            var loader = TimelineEditorLoader.Instance;
            if (loader == null)
            {
                Debug.LogWarning("当前加载器不存在。");
                return;
            }
            if (loader.trackView == null)
            {
                Debug.LogWarning("track-view.uxml文件不存在，请检查下，是否将uxml文件拖入TimelineEditorLoader.cs文件的Inspector面板内。");
                return;
            }
            if (loader.trackViewStyle == null)
            {
                Debug.LogWarning("track-view.uss文件不存在，请检查下，是否将uss文件拖入TimelineEditorLoader.cs文件的Inspector面板内。");
                return;
            }
            loader.trackView.CloneTree(this);
            styleSheets.Add(loader.trackViewStyle);
        }
    }
}